/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */

package tv.global.dao;

import java.util.ArrayList;
import java.util.List;
import javax.ejb.Stateless;
import javax.ejb.LocalBean;
import javax.persistence.Query;
import tv.global.modelo.ItemBanner;
import tv.global.modelo.ItemVideo;
import tv.global.modelo.ItemVideoPK;

/**
 *
 * @author Claudio
 */
@Stateless
public class VideosDAO extends BaseDAO {

    public List<ItemVideo> getLista(){

        try {
            String sQuery = "SELECT m FROM ItemVideo m WHERE m.debaja = 'N' and m.activo = 'S' "
                    + "and m.itemVideoPK.idConf = 1 "
                    + "ORDER BY m.orden";
            Query q = getEntityManager().createQuery(sQuery);
            return q.getResultList();
            
        } catch (Exception e){
            e.printStackTrace();
            System.err.println("Error al obtener lista de videos");
            return new ArrayList<ItemVideo>();
        }
    }

    public ItemVideo getVideo(int orden) {

        ItemVideoPK idPK = new ItemVideoPK(1, orden);
        return getObjeto(ItemVideo.class, idPK);


    }
    
}
